home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 4 / The Pier Shareware #4 (The Pier Exchange) (1994).ISO / 038 / prochook.exe / PHINTERN.H < prev    next >
C/C++ Source or Header  |  1994-01-01  |  5KB  |  154 lines

  1. /*
  2.   PHINTERN.H - Copyright (c) 1993 James M. Finnegan, All Rights Reserved
  3. */
  4.  
  5. // Internal ProcHook stuff, only to be used my modules linked
  6. // to the ProcHook DLL
  7.  
  8. #ifndef _INC_PHINTERN
  9. #define _INC_PHINTERN
  10.  
  11. #ifdef __cplusplus
  12. extern "C" {            // No mangling!
  13. #endif
  14.  
  15.  
  16. #include <windows.h>
  17. #include "prochook.h"
  18.  
  19. // Byte pack structures
  20. #pragma pack(1) 
  21.  
  22. // Signature defines
  23. #define MASTER_SIG  'JF'
  24. #define CHILD_SIG   'CF'
  25.  
  26. // JMP opcode define
  27. #define JMP_OPCODE  0xEA
  28.  
  29. // "Pseudo-undocumented" Windows Function
  30. WORD FAR PASCAL AllocCStoDSAlias(WORD);
  31.  
  32. // Internally used functions
  33. BOOL CheckMasterRecord(LPHOOKMASTER);
  34. BOOL CheckChildRecord (LPHOOKCHILD);
  35.  
  36.  
  37.  
  38. // The following stuff is for PROCINFO.C
  39.  
  40. // Module Table signature
  41. #define NE_SIGNATURE 'EN'     // 'NE' in LOBYTE/HIBYTE (Intel) format
  42.  
  43. // Module Table data sructure
  44. typedef struct tagMODTABLE
  45. {
  46.     WORD     wModSig;         // Module signature "NE"
  47.     WORD     wLoadCount;      // Load count
  48.     WORD     npEntryTable;    // Ptr to entry table
  49.     WORD     npNextMod;       // Ptr to next module
  50.     WORD     npDGroup;        // Ptr to DGROUP
  51.     WORD     npFileInfo;      // Module file info
  52.     WORD     wModFlags;       // Module flags
  53.     WORD     wDGroupSeg;      // Logical segment # of DGROUP
  54.     WORD     wInitHeap;       // Initial heap size
  55.     WORD     wInitStack;      // Initial stack size
  56.     DWORD    dwInitCSIP;      // Initial instruction pointer
  57.     DWORD    dwInitSSSP;      // Initial stack pointer
  58.     WORD     wSegCount;       // Segment count
  59.     WORD     wModRefCount;    // Module reference table entry count
  60.     WORD     wNonResNameSize; // Size of non-resident names table on disk
  61.     WORD     npSegTab;        // Ptr to segment table
  62.     WORD     npResourceTab;   // Ptr to resource table
  63.     WORD     npResNameTab;    // Ptr to resident name table
  64.     WORD     npModRefTab;     // Ptr to module reference talbe
  65.     WORD     npImpNameTab;    // Ptr to import names table
  66.     DWORD    dwNonResNameOff; // Non-resident name table offset on disk 
  67.     WORD     wMovEntCount;    // Moveable entry count
  68.     WORD     wSectorAlign;    // Sector alignment
  69.     WORD     wTTF;            // TrueType font
  70.     WORD     wOSflags;        // OS flags
  71.     WORD     wUnknown38;
  72.     WORD     wUnknown3A;
  73.     WORD     wUnknown3C;
  74.     WORD     wExpOSver;       // Expected OS version
  75. }MODTABLE;
  76.     
  77. typedef MODTABLE            *PMODTABLE;
  78. typedef MODTABLE NEAR       *NPMODTABLE;
  79. typedef MODTABLE FAR        *LPMODTABLE;
  80.  
  81.                                        
  82. // Segment Record data sructure
  83. typedef struct tagSEGREC
  84. {
  85.     WORD    wSelOffset;       // Offset to logical selector on disk
  86.     WORD    wSelLength;       // Size of logical segment     
  87.     WORD    wFlags;           // Flags          
  88.     WORD    wSelSize;         // Initial size of segment    
  89.     WORD    wHandle;          // Handle/Selector to segment
  90. }SEGREC;
  91.  
  92. typedef SEGREC              *PSEGREC;
  93. typedef SEGREC NEAR         *NPSEGREC;
  94. typedef SEGREC FAR          *LPSEGREC;
  95.  
  96.  
  97. // Export Ordinal Bundle data sructure
  98. typedef struct tagBUNDLE
  99. {
  100.     WORD    wFirstOrdinal;    // First Ordinal in bundle
  101.     WORD    wLastOrdinal;     // Last Ordinal in bundle
  102.     WORD    npNextBundle;     // Ptr to next bundle
  103. }BUNDLE;
  104.  
  105. typedef BUNDLE            *PBUNDLE;
  106. typedef BUNDLE NEAR       *NPBUNDLE;
  107. typedef BUNDLE FAR        *LPBUNDLE;
  108.  
  109.                                        
  110. // Ordinal Entry data sructure
  111. typedef struct tagENTRY
  112. {
  113.     BYTE    bySegmentType;    // Segment type
  114.     BYTE    byFlags;          // Flags
  115.     BYTE    bySegmentNumber;  // Logical segment number
  116.     WORD    wOffset;          // Offset of entry
  117. }ENTRY;
  118.  
  119. typedef ENTRY            *PENTRY;
  120. typedef ENTRY NEAR       *NPENTRY;
  121. typedef ENTRY FAR        *LPENTRY;
  122.  
  123.  
  124. // Module File Information data sructure
  125. typedef struct tagMODFILE
  126. {
  127.     BYTE  byLength;           // Length of structure
  128.     BYTE  byFlag;             // flags
  129.     WORD  wUnknown;           
  130.     WORD  wDate;              // File Date
  131.     WORD  wTime;              // File Time
  132.     char  szFileName[1];      // DOS qualified filename
  133. }
  134. MODFILE;
  135.  
  136. typedef MODFILE            *PMODFILE;
  137. typedef MODFILE NEAR       *NPMODFILE;
  138. typedef MODFILE FAR        *LPMODFILE;
  139.  
  140. // Internally used functions
  141. BOOL  CheckModPtr  (LPMODTABLE);
  142. WORD  HandleToSel  (HANDLE);
  143. LPSTR WalkNameTable(LPSTR, WORD);
  144.  
  145.  
  146. // Set packing back to its default
  147. #pragma pack()
  148.  
  149. #ifdef __cplusplus
  150. }                       // End of extern "C" {
  151. #endif 
  152.  
  153. #endif  // _INC_PHINTERN
  154.